package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.LoginDto;
import com.heima.user.service.ApUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

@RestController
@RequestMapping("/api/v1/login")
@Tag(name = "登录模块")
@Slf4j
public class ApUserLoginController {

    @Autowired
    private ApUserService apUserService;

    @Operation(summary = "登录")
    @PostMapping("/login_auth/")
    public ResponseResult login(@RequestBody LoginDto dto) {
//        log.info("loginDto: {}", dto);
        return apUserService.Login(dto);
    }

    @GetMapping("/test")
    public String test() {
        return "test";
    }

}
